home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 February / PCWFEB06.iso / Software / Resources / Audacity 1.23 / audacity-win-1.2.3.exe / {app} / Nyquist / system.lsp < prev    next >
Lisp/Scheme  |  2003-07-01  |  4KB  |  118 lines

  1. ; system.lsp -- machine/system-dependent definitions
  2.  
  3. ;; default behavior is to call SETUP-CONSOLE to get large white typescript
  4. ;;
  5. ;; set *setup-console* to nil in your personal init.lsp to override this behavior 
  6. ;; (this may be necessary to work with emacs)
  7. ;;
  8. (if (not (boundp '*setup-console*)) (setf *setup-console* t))
  9. (if *setup-console* (setup-console))
  10.  
  11. (setf ny:bigendianp nil)
  12.  
  13. (if (not (boundp '*default-sf-format*))
  14.     (setf *default-sf-format* snd-head-Wave))
  15.  
  16. ;(if (not (boundp '*default-sound-file*))
  17. ;    (setf *default-sound-file* "temp.wav"))
  18.  
  19. ;(if (not (boundp '*default-sf-dir*))
  20. ;    (setf *default-sf-dir* ""))
  21.  
  22. (if (not (boundp '*default-sf-mode*))
  23.     (setf *default-sf-mode* snd-head-mode-pcm))
  24.  
  25. (if (not (boundp '*default-sf-bits*))
  26.     (setf *default-sf-bits* 16))
  27.  
  28. ;(if (not (boundp '*default-plot-file*))
  29. ;    (setf *default-plot-file* "points.dat"))
  30.  
  31. ;(if (not (boundp '*plotscript-file*))
  32. ;    (setf *plotscript-file* "sys/unix/rs6k/plotscript"))
  33.  
  34. ; local definition for play
  35. ;(defmacro play (expr)
  36. ;  `(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*))
  37.  
  38.  
  39. ;(defun r ()
  40. ;  (s-save (s-read *default-sound-file*) NY:ALL "" :play t)
  41. ;)
  42.  
  43.  
  44. ; PLAY-FILE -- play a file
  45. ;(defun play-file (name)
  46. ;  (s-save (s-read name) NY:ALL "" :play t))
  47.  
  48.  
  49. ; FULL-NAME-P -- test if file name is a full path or relative path
  50. ;
  51. ; (otherwise the *default-sf-dir* will be prepended
  52. ;
  53. (defun full-name-p (filename)
  54.   (or (eq (char filename 0) #\\)
  55.       (eq (char filename 0) #\.)
  56.       (and (> (length filename) 2)
  57.          (both-case-p (char filename 0))
  58.        (equal (char filename 1) #\:))))
  59.  
  60. (setf *file-separator* #\\)
  61.  
  62. ;(defun ny:load-file () (load "*.*"))
  63. ;(defun ny:reload-file () (load "*"))
  64.  
  65.  
  66. ; save the standard function to write points to a file
  67. ;
  68. ;(setfn s-plot-points s-plot)
  69.  
  70. ;(defun array-max-abs (points)
  71. ;  (let ((m 0.0))
  72. ;        (dotimes (i (length points))
  73. ;          (setf m (max m (abs (aref points i)))))
  74. ;        m))
  75.  
  76. ;(setf graph-width 600)
  77. ;(setf graph-height 220)
  78.  
  79. ;(defun s-plot (snd &optional (n 600))
  80. ;  (show-graphics)
  81. ;  (clear-graphics)
  82. ;  (cond ((soundp snd)
  83. ;               (s-plot-2 snd n (/ graph-height 2) graph-height))
  84. ;              (t
  85. ;               (let ((gh (/ graph-height (length snd)))
  86. ;                     hs)
  87. ;                 (dotimes (i (length snd))
  88. ;                   (setf hs (s-plot-2 (aref snd i) n (+ (/ gh 2) (* i gh)) gh hs)))))))
  89. ;
  90. ;
  91. ;(defun s-plot-2 (snd n y-offset graph-height horizontal-scale)
  92. ;  (prog ((points (snd-samples snd n))
  93. ;                   maxpoint horizontal-scale vertical-scale)
  94. ;    (setf maxpoint (array-max-abs points))
  95. ;    (moveto 0 y-offset)
  96. ;    (lineto graph-width y-offset)
  97. ;    (moveto 0 y-offset)
  98. ;    (cond ((null horizontal-scale)
  99. ;               (setf horizontal-scale (/ (float graph-width) (length points)))))
  100. ;    (setf vertical-scale (- (/ (float graph-height) 2 maxpoint)))
  101. ;    (dotimes (i (length points))
  102. ;      (lineto (truncate (* horizontal-scale i))
  103. ;              (+ y-offset (truncate (* vertical-scale (aref points i))))))
  104. ;    (format t "X Axis: ~A to ~A (seconds)\n" (snd-t0 snd) (/ (length points) (snd-srate snd)))
  105. ;    (format t "Y Axis: ~A to ~A\n" (- maxpoint) maxpoint)
  106. ;    (format t "~A samples plotted.\n" (length points))
  107. ;    (return horizontal-scale)
  108. ;    ))
  109. ;
  110. ; S-EDIT - run the audio editor on a sound
  111. ;
  112. ;(defmacro s-edit (&optional expr)
  113. ;  `(prog ()
  114. ;         (if ,expr (s-save ,expr 1000000000 *default-sound-file*))
  115. ;         (system (format nil "audio_editor ~A &" 
  116. ;                         (soundfilename *default-sound-file*)))))
  117.  
  118.